# 使用官方的 Go 镜像作为基础镜像
FROM golang:1.22 AS builder


COPY . /src
WORKDIR /src/redis-cluster-demo

RUN go env -w GO111MODULE=on
RUN go env -w GOPROXY=https://goproxy.cn,direct
RUN mkdir -p bin/ && go build  -o ./bin/ ./...

FROM debian:stable-slim

RUN apt-get update && apt-get install -y
#RUN apt-get update && apt-get install -y --no-install-recommends \
#		ca-certificates  \
#        netbase \
#        && rm -rf /var/lib/apt/lists/ \
#        && apt-get autoremove -y && apt-get autoclean -y

COPY --from=builder /src/redis-cluster-demo /app

WORKDIR /app

EXPOSE 8080

CMD ["./bin/redis-cluster-demo"]
#CMD ["cd .."]
#CMD ["ls"]
